home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume91 / utilitys / bigbrthr / part01 / bigbrother.asm next >
Assembly Source File  |  1991-03-20  |  42KB  |  2,392 lines

  1. ;====================================================================
  2. ;= Big Brother V2.11 by The Orega Programming Group Holland (c)1989 =
  3. ;= Programmer: EA van Breemen                        =
  4. ;= Assembler : DevPac 2.14                                          =
  5. ;====================================================================
  6.     
  7. ;====================================================================
  8. ;= Modifications:                            =
  9. ;= 24-1-90:   fixed ctrl-Help bug                    =
  10. ;=            added newcli                        =
  11. ;=            optimized coding                        =
  12. ;= 26-1-90:   added newcli gadget                    =
  13. ;=            modified tekstborder                    =
  14. ;=            fixed 'system has been modified' tekst bug        =
  15. ;= 27-1-90:   fixed AlertWarning                    =
  16. ;=            adjusted some windowsizes                    =
  17. ;=            intuified viewbootblocktekst                =
  18. ;=            regulated bootio errors                    =
  19. ;=            added help                        =
  20. ;=            added preferences                        =
  21. ;= 21-10-90   fixed the memory clean message update bug             =
  22. ;=            added script options                                  = 
  23. ;= 23-10-90   make auto detaching                    =
  24. ;= 24-10-90   fixed another clean message box bug            =
  25. ;=          added ReBoot routine                    =   
  26. ;= 25-10-90   BigBrother is now using the official reboot           =
  27. ;= 27-10-90   Fixed the endcli bug                    =
  28. ;= 01-12-90   Fixed multiple selection bug. BB replies to all       =
  29. ;=            messages first before next Wait                =
  30. ;=            Version 2.11 Final release.                           = 
  31. ;====================================================================
  32.  
  33.     
  34. XLIB    macro
  35.     xref    _LVO\1
  36.     endm
  37.  
  38.  
  39. MEMORY        equ    $1
  40. VIEW        equ    $2
  41. CLEAR        equ    $3
  42. INSTALL        equ    $4
  43. DRIVE        equ    $5
  44. WATCH        equ    $6
  45. NEWSHELL    equ    $7
  46. HELP        equ    $8
  47. REBOOT        equ    $9
  48.  
  49.  
  50. READ        equ    $2
  51. WRITE        equ    $3
  52.  
  53.  
  54. IECLASS_RAWKEY        equ    $01
  55. IEQUALIFIER_CONTROL     equ    $08
  56.  
  57. HELP_KEY        equ    $5f
  58. FUNC_F1            equ    $50
  59. FUNC_F2            equ    $51
  60. FUNC_F3            equ    $52
  61. FUNC_F4            equ    $53
  62. FUNC_F5            equ    $54
  63. FUNC_F6            equ    $55
  64. FUNC_F7            equ    $56
  65. FUNC_F8            equ    $57
  66. FUNC_F9            equ    $58
  67. FUNC_F10        equ    $59
  68.  
  69.  
  70.  
  71. IND_ADDHANDLER        equ    $09
  72. NT_MESSAGE        equ    $05
  73. NT_MSGPORT        equ    $04
  74. PA_SIGNAL        equ    $00
  75. io_Message        equ    $00
  76. io_Data            equ    $28
  77. io_Command        equ    $1c
  78. Ln_Type            equ    $08
  79. Ln_Name            equ    $0a
  80. Ln_Pri            equ    $09
  81. mp_Node            equ    $00
  82. mp_SigBit        equ    $0f
  83. mp_Flags        equ    $0e
  84. mp_SigTask        equ    $10
  85. mn_Node            equ    $00
  86. mn_Length        equ    $12
  87. mn_ReplyPort        equ    $0e
  88.  
  89. gg_GadgetID        equ    $26
  90.  
  91. im_Class        equ    $14
  92. im_Code            equ    $18
  93. im_Address        equ    $1c
  94.  
  95. wd_UserPort        equ    $56
  96. wd_RPort        equ    $32
  97.  
  98. WindowPtr        equ    $b8
  99.  
  100. is_Code            equ    $12
  101. is_Data            equ    $0e
  102. is_Node            equ    $00
  103.  
  104. GADGETUP        equ    $40
  105. GADGHNONE        equ    $03
  106. CLOSEWINDOW        equ    $200
  107. WINDOWDRAG        equ    $02
  108. WINDOWDEPTH        equ    $04
  109. WINDOWCLOSE        equ    $08
  110. ACTIVATE        equ    $1000
  111. NOCAREREFRESH        equ    $20000
  112. WBENCHSCREEN        equ    $01
  113. RELVERIFY        equ    $01
  114. BOOLGADGET        equ    $01
  115. RP_JAM1            equ    $00
  116. RP_JAM2            equ    $01
  117.  
  118. TD_CHANGESTATE        equ    14
  119.  
  120. NULL            equ    $00
  121.  
  122. MAGIC_ROMEND        EQU $01000000   ;End of Kickstart ROM
  123. MAGIC_SIZEOFFSET    EQU -$14        ;Offset from end of ROM to Kickstart size
  124. V36_EXEC        EQU 36        ;Exec with the ColdReboot() function
  125. TEMP_ColdReboot     EQU -726        ;Offset of the V36 ColdReboot function
  126. LIB_VERSION    EQU    $14
  127.  
  128.  
  129.     XLIB    OpenLibrary
  130.     XLIB    CloseLibrary
  131.     XLIB    OpenDevice
  132.     XLIB    CloseDevice
  133.     XLIB    OpenWindow
  134.     XLIB    CloseWindow
  135.     XLIB    DoIO
  136.     XLIB    Delay
  137.     XLIB    GetMsg
  138.     XLIB    ReplyMsg
  139.     XLIB    AllocSignal
  140.     XLIB    FreeSignal
  141.     XLIB    FindTask
  142.     XLIB    AddPort
  143.     XLIB    RemPort
  144.     XLIB    FindName
  145.     XLIB    DeviceProc
  146.     XLIB    RefreshGadgets
  147.     XLIB    Wait
  148.     XLIB    Move
  149.     XLIB    Text
  150.     XLIB    SetAPen
  151.     XLIB    AllocMem
  152.     XLIB    FreeMem
  153.     XLIB    SetWindowTitles
  154.     XLIB    FindResident
  155.     XLIB    RemTask
  156.     XLIB    DisplayBeep
  157.     XLIB    Disable
  158.     XLIB    Enable
  159.     XLIB    DrawBorder
  160.     XLIB    PrintIText
  161.     XLIB    WBenchToFront
  162.     XLIB    DisplayAlert
  163.     XLIB    SizeWindow
  164.     XLIB    WaitPort
  165.     XLIB    Open
  166.     XLIB    Close
  167.     XLIB    Read
  168.     XLIB    Lock
  169.     XLIB    UnLock
  170.     XLIB    Execute
  171.     XLIB    CreateProc
  172.     XLIB    WaitPort
  173.     XLIB    Supervisor    
  174.     XLIB    Write
  175.     XLIB    Output
  176.  
  177. _ASyncRun    equ    -$222
  178. STACK_SIZE    equ    4096
  179.  
  180.  
  181.  
  182. ;===================================
  183. ;= Startup code for auto detaching =
  184. ;= BigBrother V2.11                =
  185. ;===================================
  186.  
  187.     
  188.     section    "Startup",code
  189.  
  190. start    move.l    $4,a6
  191.     sub.l    a1,a1
  192.     jsr    _LVOFindTask(a6)
  193.     move.l    d0,a4
  194.     tst.l    $ac(a4)            ; Are we from the WBench ????
  195.     bne.s    from_cli
  196.     lea.l    $5c(a4),a0
  197.     jsr    _LVOWaitPort(a6)
  198.     jsr    _LVOGetMsg(a6)        ; Get message
  199. from_cli:
  200.     move.l    $4,a6
  201.     lea.l    DosName,a1
  202.     clr.l    d0
  203.     jsr    _LVOOpenLibrary(a6)
  204.     move.l    d0,a5
  205.     beq    uit
  206.     move.l    a5,a6
  207.     jsr    _LVOOutput(a6)
  208.     move.l    d0,d1
  209.     move.l    #Title,d2
  210.     move.l    #80,d3
  211.     jsr    _LVOWrite(a6)
  212.     move.l    #NIL_NAME,d1
  213.     move.l    #1006,d2
  214.     jsr    _LVOOpen(a6)
  215.     move.l    d0,pcb_Input
  216.     move.l    d0,pcb_Output
  217.     
  218.  
  219.     move.l    $4,a6
  220.     lea.l    ArpName,a1
  221.     clr.l    d0
  222.     jsr    _LVOOpenLibrary(a6)
  223.     move.l    d0,ArpBase
  224.     bne    1$
  225.     bra    2$
  226. 1$    move.l    ArpBase,a6
  227.     move.l    #0,a0
  228.     move.l    #0,a1
  229.     lea.l    newshell2,a2
  230.     jsr    _ASyncRun(a6)
  231.     move.l    $4,a6
  232.     move.l    ArpBase,a1
  233.     jsr    _LVOCloseLibrary(a6)    ; Close Arp
  234.  
  235.     lea.l    start,a0
  236.     move.l    #0,-4(a0)        ; Erase pointer to next segment
  237.     
  238. 2$    move.l    $4,a6
  239.     move.l    a5,a1
  240.     jsr    _LVOCloseLibrary(a6)
  241.  
  242. uit    rts
  243.  
  244.  
  245.  
  246.     data
  247.  
  248. Title    dc.b    'BigBrother V2.11 ',169,'1990 by EA van Breemen',10,13
  249.     dc.b    'The Orega Programming Group Holland.',10,13,0
  250.     
  251.     even
  252.  
  253. NewWindowStructure1:
  254.     dc.w    62,30
  255.     dc.w    330,126
  256.     dc.b    0,1
  257.     dc.l    GADGETUP+CLOSEWINDOW
  258.     dc.l    WINDOWDRAG+WINDOWDEPTH+WINDOWCLOSE+ACTIVATE+NOCAREREFRESH
  259.     dc.l    Gadget1
  260.     dc.l    NULL
  261.     dc.l    CopyrightName
  262.     dc.l    NULL
  263.     dc.l    NULL
  264.     dc.w    5,5
  265.     dc.w    -1,-1
  266.     dc.w    WBENCHSCREEN
  267. NewWindowStructure2:
  268.     dc.w    0,0
  269. hsize    dc.w    550,150
  270.     dc.b    0,1
  271.     dc.l    CLOSEWINDOW
  272.     dc.l    ACTIVATE+NOCAREREFRESH+WINDOWCLOSE
  273.     dc.l    NULL
  274.     dc.l    NULL
  275. title2    dc.l    InitTitle
  276.     dc.l    NULL
  277.     dc.l    NULL
  278.     dc.w    5,5
  279.     dc.w    -1,-1
  280.     dc.w    WBENCHSCREEN
  281. CopyrightName:
  282.     dc.b 'Big Brother V2.11',0
  283.     dc.b    ' ',169,'1989/1990',0
  284.     cnop 0,2
  285. InitTitle:
  286.     dc.b    'BootBlock:',0
  287.     even
  288. ViewTitle:
  289.     dc.b    'Contents of ExecBase:',0
  290.     even
  291. InstallTitle:
  292.     dc.b    'Installing BootBlock',0
  293.     even
  294. HelpTitle:
  295.     dc.b    'Help',0
  296.     even
  297. install_message:
  298.     dc.b    'Disk has been installed',0
  299.     even
  300. install_fail:
  301.     dc.b    'Install has failed',0
  302.     even
  303. disk_protected:
  304.     dc.b    'Disk is write-protected!',0
  305.     even
  306. disk_changed:
  307.     dc.b    'Disk has been removed!',0
  308.     even
  309. StandardBootBlock:
  310.     dc.b    'Standard BootBlock by The Orega Programming Group Holland.'
  311.     dc.b    ' Copyright 1989,1990. Installed by Big Brother V2.11'
  312. Standardend:
  313.     even
  314. prefs_file:
  315.     dc.b    's:big_prefs',0
  316.     even
  317. Gadget1:
  318.     dc.l    Gadget2
  319.     dc.w    29,22
  320.     dc.w    80,15
  321.     dc.w    GADGHNONE
  322.     dc.w    RELVERIFY
  323.     dc.w    BOOLGADGET
  324.     dc.l    Border1
  325.     dc.l    NULL
  326.     dc.l    IText1
  327.     dc.l    NULL
  328.     dc.l    NULL
  329.     dc.w    DRIVE
  330.     dc.l    NULL
  331. Border1:
  332.     dc.w    0,0
  333.     dc.b    2,0,RP_JAM2
  334.     dc.b    5
  335.     dc.l    BorderVectors1
  336.     dc.l    Border1a
  337. Border1a:
  338.     dc.w    -1,-1
  339.     dc.b    1,0,RP_JAM1
  340.     dc.b    5
  341.     dc.l    BorderVectors1
  342.     dc.l    NULL
  343. BorderVectors1:
  344.     dc.w    0,0
  345.     dc.w    80,0
  346.     dc.w    80,15
  347.     dc.w    0,15
  348.     dc.w    0,0
  349.  
  350. ;======== Custom Drawing =======================
  351.  
  352. Border2:
  353.     dc.w    30,96
  354.     dc.b    2,0,RP_JAM2
  355.     dc.b    5
  356.     dc.l    BorderVectors2
  357.     dc.l    Border3
  358. Border3:
  359.     dc.w    28,95
  360.     dc.b    1,0,RP_JAM1
  361.     dc.b    5
  362.     dc.l    BorderVectors2
  363.     dc.l    NULL
  364. BorderVectors2:            ; Tekstbox of mainwindow
  365.     dc.w    0,0
  366.     dc.w    283,0
  367.     dc.w    283,26
  368.     dc.w    0,26
  369.     dc.w    0,0
  370. MyTekst:
  371.     dc.b    2,0,RP_JAM2,0
  372.     dc.w    45,110
  373.     dc.l    NULL
  374. Mt1    dc.l    NULL
  375.     dc.l    MyTekst2
  376. MyTekst2:
  377.     dc.b    1,0,RP_JAM1,0
  378.     dc.w    44,109
  379.     dc.l    NULL
  380. Mt2    dc.l    NULL
  381.     dc.l    NULL
  382. MyTekst3:
  383.     dc.b    2,0,RP_JAM2,0
  384.     dc.w    45,100
  385.     dc.l    NULL
  386. Mt3    dc.l    NULL
  387.     dc.l    MyTekst4
  388. MyTekst4:
  389.     dc.b    1,0,RP_JAM1,0
  390.     dc.w    44,99
  391.     dc.l    NULL
  392. Mt4    dc.l    NULL
  393.     dc.l    NULL
  394.  
  395.  
  396. ;=====================================================
  397. ;= IntuiText structures for clearing the message box =
  398. ;=====================================================
  399.  
  400. MyTekst3a:
  401.     dc.b    2,0,RP_JAM2,0
  402.     dc.w    45,100
  403.     dc.l    NULL
  404.     dc.l    L10
  405.     dc.l    MyTekst4a
  406. MyTekst4a:
  407.     dc.b    1,0,RP_JAM2,0
  408.     dc.w    44,99
  409.     dc.l    NULL
  410.     dc.l    L10
  411.     dc.l    MyTekst3b
  412. MyTekst3b:
  413.     dc.b    2,0,RP_JAM2,0
  414.     dc.w    45,110
  415.     dc.l    NULL
  416.     dc.l    L10
  417.     dc.l    MyTekst4b
  418. MyTekst4b:
  419.     dc.b    1,0,RP_JAM2,0
  420.     dc.w    44,109
  421.     dc.l    NULL
  422.     dc.l    L10
  423.     dc.l    NULL
  424.  
  425.  
  426.  
  427. MyTekst5:
  428.     dc.b    2,0,RP_JAM2,0
  429.     dc.w    40,25
  430.     dc.l    NULL
  431. Mt5    dc.l    NULL
  432.     dc.l    MyTekst6
  433. MyTekst6:
  434.     dc.b    1,0,RP_JAM1,0
  435.     dc.w    39,24
  436.     dc.l    NULL
  437. Mt6    dc.l    NULL
  438.     dc.l    NULL
  439.  
  440. ;=====================================
  441.  
  442.  
  443. IText1:
  444.     dc.b    2,0,RP_JAM2,0
  445.     dc.w    21,3
  446.     dc.l    NULL
  447.     dc.l    DummyTekst
  448.     dc.l    IText1a
  449. IText1a:
  450.     dc.b    2,0,RP_JAM2,0
  451.     dc.w    22,4
  452.     dc.l    NULL
  453.     dc.l    ITextText1
  454.     dc.l    IText1b
  455. IText1b:
  456.     dc.b    1,0,RP_JAM1,0
  457.     dc.w    21,3
  458.     dc.l    NULL
  459.     dc.l    ITextText1
  460.     dc.l    NULL
  461.  
  462. ITextText1:
  463.     dc.b    'DF0:',0
  464.     cnop 0,2
  465. DummyTekst:
  466.     dc.b    '    ',0
  467.     cnop 0,2
  468. Gadget2:
  469.     dc.l    Gadget3
  470.     dc.w    128,46
  471.     dc.w    80,15
  472.     dc.w    NULL
  473.     dc.w    RELVERIFY
  474.     dc.w    BOOLGADGET
  475.     dc.l    Border1
  476.     dc.l    NULL
  477.     dc.l    IText2
  478.     dc.l    NULL
  479.     dc.l    NULL
  480.     dc.w    MEMORY
  481.     dc.l    NULL
  482. IText2:
  483.     dc.b    2,0,RP_JAM2,0
  484.     dc.w    15,4
  485.     dc.l    NULL
  486.     dc.l    ITextText2
  487.     dc.l    IText2b
  488. IText2b:
  489.     dc.b    1,0,RP_JAM1,0
  490.     dc.w    14,3
  491.     dc.l    NULL
  492.     dc.l    ITextText2
  493.     dc.l    NULL
  494. ITextText2:
  495.     dc.b    'Memory',0
  496.     cnop 0,2
  497. Gadget3:
  498.     dc.l    Gadget4
  499.     dc.w    229,22
  500.     dc.w    80,15
  501.     dc.w    NULL
  502.     dc.w    RELVERIFY
  503.     dc.w    BOOLGADGET
  504.     dc.l    Border1
  505.     dc.l    NULL
  506.     dc.l    IText3
  507.     dc.l    NULL
  508.     dc.l    NULL
  509.     dc.w    INSTALL
  510.     dc.l    NULL
  511.  
  512. IText3:
  513.     dc.b    2,0,RP_JAM2,0
  514.     dc.w    13,4
  515.     dc.l    NULL
  516.     dc.l    ITextText3
  517.     dc.l    IText3b
  518. IText3b:
  519.     dc.b    1,0,RP_JAM1,0
  520.     dc.w    12,3
  521.     dc.l    NULL
  522.     dc.l    ITextText3
  523.     dc.l    NULL
  524. ITextText3:
  525.     dc.b    'Install',0
  526.     cnop 0,2
  527. Gadget4:
  528.     dc.l    Gadget5
  529.     dc.w    29,46
  530.     dc.w    80,15
  531.     dc.w    NULL
  532.     dc.w    RELVERIFY
  533.     dc.w    BOOLGADGET
  534.     dc.l    Border1
  535.     dc.l    NULL
  536.     dc.l    IText4
  537.     dc.l    NULL
  538.     dc.l    NULL
  539.     dc.w    WATCH
  540.     dc.l    NULL
  541.  
  542. IText4:
  543.     dc.b    2,0,RP_JAM2,0
  544.     dc.w    22,4
  545.     dc.l    NULL
  546.     dc.l    ITextText4
  547.     dc.l    IText4b
  548. IText4b:
  549.     dc.b    1,0,RP_JAM1,0
  550.     dc.w    21,3
  551.     dc.l    NULL
  552.     dc.l    ITextText4
  553.     dc.l    NULL
  554. ITextText4:
  555.     dc.b    'Watch',0
  556.     cnop 0,2
  557. Gadget5:
  558.     dc.l    Gadget6
  559.     dc.w    229,46
  560.     dc.w    80,15
  561.     dc.w    NULL
  562.     dc.w    RELVERIFY
  563.     dc.w    BOOLGADGET
  564.     dc.l    Border1
  565.     dc.l    NULL
  566.     dc.l    IText5
  567.     dc.l    NULL
  568.     dc.l    NULL
  569.     dc.w    CLEAR
  570.     dc.l    NULL
  571.  
  572. IText5:
  573.     dc.b    2,0,RP_JAM2,0
  574.     dc.w    22,4
  575.     dc.l    NULL
  576.     dc.l    ITextText5
  577.     dc.l    IText5b
  578. IText5b:
  579.     dc.b    1,0,RP_JAM1,0
  580.     dc.w    21,3
  581.     dc.l    NULL
  582.     dc.l    ITextText5
  583.     dc.l    NULL
  584. ITextText5:
  585.     dc.b    'Clear',0
  586.     cnop 0,2
  587. Gadget6:
  588.     dc.l    Gadget7
  589.     dc.w    128,22
  590.     dc.w    80,15
  591.     dc.w    NULL
  592.     dc.w    RELVERIFY
  593.     dc.w    BOOLGADGET
  594.     dc.l    Border1
  595.     dc.l    NULL
  596.     dc.l    IText6
  597.     dc.l    NULL
  598.     dc.l    NULL
  599.     dc.w    VIEW
  600.     dc.l    NULL
  601.  
  602. IText6:
  603.     dc.b    2,0,RP_JAM2,0
  604.     dc.w    22,4
  605.     dc.l    NULL
  606.     dc.l    ITextText6
  607.     dc.l    IText6b
  608. IText6b:
  609.     dc.b    1,0,RP_JAM1,0
  610.     dc.w    21,3
  611.     dc.l    NULL
  612.     dc.l    ITextText6
  613.     dc.l    NULL
  614. ITextText6:
  615.     dc.b    'View',0
  616.     even
  617.     
  618. Gadget7:
  619.     dc.l    Gadget8
  620.     dc.w    29,70
  621.     dc.w    80,15
  622.     dc.w    NULL
  623.     dc.w    RELVERIFY
  624.     dc.w    BOOLGADGET
  625.     dc.l    Border1
  626.     dc.l    NULL
  627.     dc.l    IText7
  628.     dc.l    NULL
  629.     dc.l    NULL
  630.     dc.w    NEWSHELL
  631.     dc.l    NULL
  632. IText7:
  633.     dc.b    2,0,RP_JAM2,0
  634.     dc.w    10,4
  635.     dc.l    NULL
  636.     dc.l    ITextText7
  637.     dc.l    IText7b
  638. IText7b:
  639.     dc.b    1,0,RP_JAM1,0
  640.     dc.w    9,3
  641.     dc.l    NULL
  642.     dc.l    ITextText7
  643.     dc.l    NULL
  644. ITextText7:
  645.     dc.b    'NewShell',0
  646.     
  647.     even
  648. Gadget8:
  649.     dc.l    Gadget9
  650.     dc.w    229,70
  651.     dc.w    80,15
  652.     dc.w    NULL
  653.     dc.w    RELVERIFY
  654.     dc.w    BOOLGADGET
  655.     dc.l    Border1
  656.     dc.l    NULL
  657.     dc.l    _IText8
  658.     dc.l    NULL
  659.     dc.l    NULL
  660.     dc.w    HELP
  661.     dc.l    NULL
  662. _IText8:
  663.     dc.b    2,0,RP_JAM2,0
  664.     dc.w    23,4
  665.     dc.l    NULL
  666.     dc.l    _ITextText8
  667.     dc.l    _IText8b
  668. _IText8b:
  669.     dc.b    1,0,RP_JAM1,0
  670.     dc.w    22,3
  671.     dc.l    NULL
  672.     dc.l    _ITextText8
  673.     dc.l    NULL
  674. _ITextText8:
  675.     dc.b    'Help',0
  676.     
  677.     even
  678.  
  679. Gadget9:
  680.     dc.l    NULL
  681.     dc.w    128,70
  682.     dc.w    80,15
  683.     dc.w    NULL
  684.     dc.w    RELVERIFY
  685.     dc.w    BOOLGADGET
  686.     dc.l    Border1
  687.     dc.l    NULL
  688.     dc.l    _IT9
  689.     dc.l    NULL
  690.     dc.l    NULL
  691.     dc.w    REBOOT
  692.     dc.l    NULL
  693. _IT9:
  694.     dc.b    2,0,RP_JAM2,0
  695.     dc.w    15,4
  696.     dc.l    NULL
  697.     dc.l    _ITT9
  698.     dc.l    _IT9b
  699. _IT9b:
  700.     dc.b    1,0,RP_JAM1,0
  701.     dc.w    14,3
  702.     dc.l    NULL
  703.     dc.l    _ITT9
  704.     dc.l    NULL
  705. _ITT9:
  706.     dc.b    'ReBoot',0
  707.     
  708.     even
  709.  
  710.  
  711. ;======== Tekst structures for viewmemory ============
  712.  
  713. IText8:
  714.     dc.b    2,0,RP_JAM2,0
  715.     dc.w    11,26
  716.     dc.l    NULL
  717. MTE8    dc.l    NULL
  718.     dc.l    IText8b
  719. IText8b:
  720.     dc.b    1,0,RP_JAM1,0
  721.     dc.w    10,25
  722.     dc.l    NULL
  723. MTE8b    dc.l    NULL
  724.     dc.l    IText9
  725.  
  726. IText9:
  727.     dc.b    2,0,RP_JAM2,0
  728.     dc.w    11,36
  729.     dc.l    NULL
  730. MTE9    dc.l    NULL
  731.     dc.l    IText9b
  732. IText9b:
  733.     dc.b    1,0,RP_JAM1,0
  734.     dc.w    10,35
  735.     dc.l    NULL
  736. MTE9b    dc.l    NULL
  737.     dc.l    IText10
  738.  
  739. IText10:
  740.     dc.b    2,0,RP_JAM2,0
  741.     dc.w    11,46
  742.     dc.l    NULL
  743. MTE10    dc.l    NULL
  744.     dc.l    IText10b
  745. IText10b:
  746.     dc.b    1,0,RP_JAM1,0
  747.     dc.w    10,45
  748.     dc.l    NULL
  749. MTE10b    dc.l    NULL
  750.     dc.l    IText11
  751.  
  752. IText11:
  753.     dc.b    2,0,RP_JAM2,0
  754.     dc.w    11,56
  755.     dc.l    NULL
  756. MTE11    dc.l    NULL
  757.     dc.l    IText11b
  758. IText11b:
  759.     dc.b    1,0,RP_JAM1,0
  760.     dc.w    10,55
  761.     dc.l    NULL
  762. MTE11b    dc.l    NULL
  763.     dc.l    IText12
  764.  
  765. IText12:
  766.     dc.b    2,0,RP_JAM2,0
  767.     dc.w    11,66
  768.     dc.l    NULL
  769. MTE12    dc.l    NULL
  770.     dc.l    IText12b
  771. IText12b:
  772.     dc.b    1,0,RP_JAM1,0
  773.     dc.w    10,65
  774.     dc.l    NULL
  775. MTE12b    dc.l    NULL
  776.     dc.l    IText13
  777.  
  778. IText13:
  779.     dc.b    2,0,RP_JAM2,0
  780.     dc.w    11,81
  781.     dc.l    NULL
  782. MTE13    dc.l    NULL
  783.     dc.l    IText13b
  784. IText13b:
  785.     dc.b    1,0,RP_JAM1,0
  786.     dc.w    10,80
  787.     dc.l    NULL
  788. MTE13b    dc.l    NULL
  789.     dc.l    NULL
  790. IText14:
  791.     dc.b    2,0,RP_JAM2,0
  792.     dc.w    10
  793. y1    dc.w    0
  794.     dc.l    NULL
  795. MTE14    dc.l    dummy
  796.     dc.l    IText14b
  797. IText14b:
  798.     dc.b    1,0,RP_JAM1,0
  799.     dc.w    9
  800. y2    dc.w    0
  801.     dc.l    NULL
  802. MTE14b    dc.l    dummy
  803.     dc.l    NULL
  804.  
  805. ;== Help strings =====================================
  806.  
  807. Text15:
  808.     dc.b    2,0,RP_JAM2,0
  809.     dc.w    11,21
  810.     dc.l    NULL
  811.     dc.l    T15
  812.     dc.l    Text15b
  813. Text15b:
  814.     dc.b    1,0,RP_JAM1,0
  815.     dc.w    10,20
  816.     dc.l    NULL
  817.     dc.l    T15
  818.     dc.l    Text16
  819. T15    dc.b    'This program is programmed by EA van Breemen',0
  820.     even
  821. Text16:
  822.     dc.b    2,0,RP_JAM2,0
  823.     dc.w    11,31
  824.     dc.l    NULL
  825.     dc.l    T16
  826.     dc.l    Text16b
  827. Text16b:
  828.     dc.b    1,0,RP_JAM1,0
  829.     dc.w    10,30
  830.     dc.l    NULL
  831.     dc.l    T16
  832.     dc.l    Text17
  833. T16    dc.b    'Copyright by The Orega Programming Group Holland',0
  834.     even
  835. Text17:
  836.     dc.b    2,0,RP_JAM2,0
  837.     dc.w    11,41
  838.     dc.l    NULL
  839.     dc.l    T17
  840.     dc.l    Text17b
  841. Text17b:
  842.     dc.b    1,0,RP_JAM1,0
  843.     dc.w    10,40
  844.     dc.l    NULL
  845.     dc.l    T17
  846.     dc.l    Text18
  847. T17    dc.b    169,'1989,1990. Any commercially based reproducing',0
  848.     even
  849. Text18:
  850.     dc.b    2,0,RP_JAM2,0
  851.     dc.w    11,51
  852.     dc.l    NULL
  853.     dc.l    T18
  854.     dc.l    Text18b
  855. Text18b:
  856.     dc.b    1,0,RP_JAM1,0
  857.     dc.w    10,50
  858.     dc.l    NULL
  859.     dc.l    T18
  860.     dc.l    Text19
  861. T18    dc.b    'by any means of this shareware product is illegal.',0
  862.     even
  863. Text19:
  864.     dc.b    2,0,RP_JAM2,0
  865.     dc.w    11,61
  866.     dc.l    NULL
  867.     dc.l    T19
  868.     dc.l    Text19b
  869. Text19b:
  870.     dc.b    1,0,RP_JAM1,0
  871.     dc.w    10,60
  872.     dc.l    NULL
  873.     dc.l    T19
  874.     dc.l    Text20
  875. T19    dc.b    'If you find this program usefull please send $10',0
  876.     even
  877. Text20:
  878.     dc.b    2,0,RP_JAM2,0
  879.     dc.w    11,71
  880.     dc.l    NULL
  881.     dc.l    T20
  882.     dc.l    Text20b
  883. Text20b:
  884.     dc.b    1,0,RP_JAM1,0
  885.     dc.w    10,70
  886.     dc.l    NULL
  887.     dc.l    T20
  888.     dc.l    Text21
  889. T20    dc.b    'to: EA van Breemen, Berliozplein 15, 2651 VG',0
  890.     even
  891. Text21:
  892.     dc.b    2,0,RP_JAM2,0
  893.     dc.w    11,81
  894.     dc.l    NULL
  895.     dc.l    T21
  896.     dc.l    Text21b
  897. Text21b:
  898.     dc.b    1,0,RP_JAM1,0
  899.     dc.w    10,80
  900.     dc.l    NULL
  901.     dc.l    T21
  902.     dc.l    Text22
  903. T21    dc.b    'Berkel en Rodenrijs,  Holland.',0
  904.     even
  905. Text22:
  906.     dc.b    2,0,RP_JAM2,0
  907.     dc.w    11,101
  908.     dc.l    NULL
  909.     dc.l    T22
  910.     dc.l    Text22b
  911. Text22b:
  912.     dc.b    1,0,RP_JAM1,0
  913.     dc.w    10,100
  914.     dc.l    NULL
  915.     dc.l    T22
  916.     dc.l    Text23
  917. T22    dc.b    'Help:   Ctrl-F1   ..... NewShell',0
  918.     even
  919. Text23:
  920.     dc.b    2,0,RP_JAM2,0
  921.     dc.w    11,111
  922.     dc.l    NULL
  923.     dc.l    T23
  924.     dc.l    Text23b
  925. Text23b:
  926.     dc.b    1,0,RP_JAM1,0
  927.     dc.w    10,110
  928.     dc.l    NULL
  929.     dc.l    T23
  930.     dc.l    NULL
  931. T23    dc.b    '        Ctrl-HELP ..... BigBrother',0
  932.     even
  933.  
  934.  
  935. ;=====================================================
  936.  
  937. expert    dc.b    0,1,2,2,3,4,5,6,3,4,7
  938.     dc.b       7,3,4,7,7,8,8,0,1,8,8
  939.     dc.b    5,5,8,8,7,7,8,8,7,7
  940.  
  941.     even
  942.  
  943. convtable    dc.b    '0123456789abcdef',0
  944.     even
  945.  
  946. message    dc.b    'This system has been modified.',0
  947. L0    dc.b    'Memory is clean.',0
  948. L1    dc.b    'Sca virus.',0
  949. L2    dc.b    'Unknown virus or not mounted rad.',0
  950. L3    dc.b    'Non reset virus.',0
  951. L4    dc.b    'Sca like virus.',0
  952. L5    dc.b    'Dasa virus.',0
  953. L6    dc.b    'Dasa like virus.',0
  954. L7    dc.b    'ByteBandit or Lamer virus.',0
  955. L8    dc.b    'Unknown system configuration???',0
  956. L9    dc.b    'System has not been modified. ',0
  957. L10    dc.b    '                                 ',0
  958.  
  959.     even
  960.  
  961. TaskName    dc.b    'RAD',0
  962.     even
  963. devicename    dc.b    'trackdisk.device',0
  964.     even
  965. MyPortName    dc.b    'BigBrother Port',0
  966.     even
  967. errormessage    dc.b    'BootBlock Read/Write Error.',0
  968.     even
  969. found_rad    dc.b    'RadTask has been found.',0
  970.     even
  971. no_found_rad    dc.b    'RadTask has not been found.',0
  972.     even
  973. loginfo    dc.b     'Launched by BigBrother V2.11',10,0
  974.     even
  975. Alertstring    dc.w    170
  976.         dc.b    15
  977.         dc.b    '! ! ! ! !  W A R N I N G ! ! ! ! ! ',0
  978.         dc.b    1
  979.         dc.w    176
  980.         dc.b    27
  981.         dc.b    'Are you sure to clear the memory?',0
  982.         dc.b    1
  983.         dc.w    10
  984.         dc.b    39
  985.         dc.b    'Press <LEFT MOUSE BUTTON> for OK  ----  Press <RIGHT MOUSE BUTTON> for CANCEL',0
  986.         dc.b    0
  987.     even
  988. Alertstring2    dc.w    170
  989.         dc.b    15
  990.         dc.b    '! ! ! ! !  W A R N I N G ! ! ! ! ! ',0
  991.         dc.b    1
  992.         dc.w    176
  993.         dc.b    27
  994.         dc.b    'Are you sure you want to Reboot? ',0
  995.         dc.b    1
  996.         dc.w    10
  997.         dc.b    39
  998.         dc.b    'Press <LEFT MOUSE BUTTON> for OK  ----  Press <RIGHT MOUSE BUTTON> for CANCEL',0
  999.         dc.b    0
  1000.     even
  1001.  
  1002. ;================
  1003. ;= Library data =
  1004. ;================
  1005.  
  1006. DosName    dc.b    'dos.library',0
  1007.     cnop 0,2
  1008. IntuitionName     dc.b 'intuition.library',0
  1009.     cnop 0,2
  1010. GraphicsName     dc.b 'graphics.library',0
  1011.     cnop 0,2
  1012. ArpName    dc.b    'arp.library',0
  1013.     even
  1014. coldcapture    dc.b    'ColdCapture - Offset   42 :$',0
  1015. coolcapture    dc.b    'CoolCapture - Offset   46 :$',0
  1016. kickmemptr    dc.b    'KickMemPtr  - Offset  546 :$',0
  1017. kicktagptr    dc.b    'KickTagPtr  - Offset  550 :$',0
  1018. doio_vector    dc.b    'DoIO Vector - Offset -454 :$',0
  1019.  
  1020. number        dc.b    '00000000',0
  1021.     even
  1022.  
  1023. BIG_NAME    dc.b    'BigBrother',0
  1024.     even
  1025. NIL_NAME    dc.b    'NIL:',0
  1026.     even
  1027.  
  1028. script2        dc.b    'Execute s:F2',0
  1029. script3        dc.b    'Execute s:F3',0
  1030. script4        dc.b    'Execute s:F4',0
  1031. script5        dc.b    'Execute s:F5',0
  1032. script6        dc.b    'Execute s:F6',0
  1033. script7        dc.b    'Execute s:F7',0
  1034. script8        dc.b    'Execute s:F8',0
  1035. script9        dc.b    'Execute s:F9',0
  1036. script10    dc.b    'Execute s:F10',0
  1037.  
  1038.  
  1039.  
  1040. ;=====================
  1041. ;= Input Device data =
  1042. ;=====================
  1043.  
  1044. InputDeviceName    dc.b    'input.device',0
  1045.     even
  1046.  
  1047.  
  1048.  
  1049. df0    dc.l    'DF0:'
  1050. df1    dc.l    'DF1:'
  1051. df2    dc.l    'DF2:'
  1052. df3    dc.l    'DF3:'
  1053.  
  1054.     dc.b    '    DoIO vector:'
  1055.     even
  1056. DoIOVector    dc.l    $fc06dc        ; DoIO Vector for V1.2
  1057.  
  1058. ;=======================
  1059. ;= Arp data structures =
  1060. ;=======================
  1061.  
  1062. newshell:                ; Process control structure for Arp
  1063.     
  1064. nsh_StackSize    dc.l    4000    ; Stacksize for new process
  1065. nsh_Pri        dc.b    0     ; Priority of new process
  1066. nsh_Control    dc.b    128+8    ; Make a newshell
  1067. nsh_LogMsg    dc.l    loginfo
  1068. nsh_Input    dc.l    0    ; Optional default input
  1069. nsh_Output    dc.l    0    ; Optional default output
  1070. nsh_Reserved    ds.l    5    ; Extra
  1071.  
  1072. CONNAME    dc.b    'CON:0/0/639/75/The Orega Programming Group Holland',0
  1073.     even
  1074.  
  1075. newshell2:                ; Process control structure for Arp
  1076.     
  1077. pcb_StackSize    dc.l    4000    ; Stacksize for new process
  1078. pcb_Pri        dc.b    0     ; Priority of new process
  1079. pcb_Control    dc.b    16    ; Make a background cli
  1080. pcb_TrapCode    dc.l    0
  1081. pcb_Input    dc.l    0    ; Optional default input
  1082. pcb_Output    dc.l    0    ; Optional default output
  1083. pcb_Console    dc.l    CONNAME    ; Union
  1084. pcb_LoadedCode    dc.l    mymain
  1085. pcb_lastGasp    dc.l    0
  1086. pcb_WBProcess    dc.l    0
  1087.  
  1088.     even
  1089.     bss
  1090.  
  1091. DOSBase            ds.l    1
  1092. GfxBase            ds.l    1
  1093. IntuitionBase        ds.l    1
  1094. ArpBase            ds.l    1
  1095. window            ds.l    1
  1096. window2            ds.l    1
  1097. rp            ds.l    1
  1098. rp2            ds.l    1
  1099. buffer            ds.l    1
  1100. keyfound        ds.w    1
  1101. commando        ds.w    1
  1102. Mode            ds.b    1
  1103. signal            ds.b    1
  1104. Flag            ds.b    1
  1105. drive            ds.b    1
  1106. io_error        ds.b    1
  1107.     even
  1108. diskio            ds.l    20
  1109. readreply        ds.l    8
  1110. memorymask        ds.l    1
  1111. filehandle        ds.l    1
  1112. lock            ds.l    1
  1113. InputRequestBlock    ds.b    $30
  1114.     even
  1115. InputDevPort        ds.b    $22
  1116.     even
  1117. HandlerStuff        ds.b    $16
  1118.     even
  1119. dummy            ds.b    70
  1120.     even
  1121. userport    ds.l    1
  1122.     code
  1123.  
  1124. ;=======================================
  1125. ;= Initialisation code for Big Brother =
  1126. ;=======================================
  1127. mymain    move.l    $4,a6
  1128.     lea.l    DosName,a1
  1129.     clr.l    d0
  1130.     jsr    _LVOOpenLibrary(a6)
  1131.     move.l    d0,DOSBase
  1132.     beq    nodos
  1133.     bsr    loadprefs
  1134.     move.l    $4,a6
  1135.     clr.l    d0
  1136.     lea.l    IntuitionName,a1
  1137.     jsr    _LVOOpenLibrary(a6)
  1138.     move.l    d0,IntuitionBase
  1139.     beq    nointuition
  1140.     clr.l    d0
  1141.     lea.l    GraphicsName,a1
  1142.     jsr    _LVOOpenLibrary(a6)
  1143.     move.l    d0,GfxBase
  1144.     beq    nographics
  1145.  
  1146.     bsr.s    initall            ; Open inputdevice etc.
  1147.     bra    check            ; Jump to checkroutine
  1148.     
  1149.  
  1150. ;==================================
  1151. ;= loadprefs: tries to load prefs =
  1152. ;==================================
  1153. loadprefs:
  1154.     move.l    DOSBase,a6
  1155.     move.l    #prefs_file,d1
  1156.     move.l    #-2,d2
  1157.     jsr    _LVOLock(a6)
  1158.     move.l    d0,lock
  1159.     beq    no_prefs
  1160.     move.l    #prefs_file,d1
  1161.     move.l    #1005,d2
  1162.     jsr    _LVOOpen(a6)
  1163.     move.l    d0,filehandle
  1164.     move.l    d0,d1
  1165.     move.l    #DoIOVector,d2
  1166.     moveq    #4,d3
  1167.     jsr    _LVORead(a6)
  1168.     move.l    filehandle,d1
  1169.     jsr    _LVOClose(a6)
  1170.     move.l    lock,d1
  1171.     jsr    _LVOUnLock(a6)
  1172. no_prefs:
  1173.     rts
  1174.     
  1175.  
  1176. ;=============================================
  1177. ;= Routine to install a input device handler =
  1178. ;=============================================
  1179.  
  1180.  
  1181. initall:                    ; Open inputdevice
  1182.     move.b    #0,signal
  1183.     move.b    #0,Flag
  1184.     move.b    #0,drive            ; df0: is default
  1185.  
  1186.     move.l    $4,a6            ; Make a message port
  1187.     moveq    #-1,d0
  1188.     jsr    _LVOAllocSignal(a6)
  1189.     lea.l    InputDevPort,a0
  1190.     move.b    d0,mp_SigBit(a0)
  1191.     move.b    #0,mp_Node+Ln_Pri(a0)
  1192.     move.b    #NT_MSGPORT,mp_Node+Ln_Type(a0)
  1193.     move.l    #MyPortName,mp_Node+Ln_Name(a0)
  1194.     move.b    #PA_SIGNAL,mp_Flags(a0)
  1195.     sub.l    a1,a1
  1196.     jsr    _LVOFindTask(a6)
  1197.     move.l    d0,a3
  1198.     move.l    #-1,WindowPtr(a3)    ; I don't want requesters
  1199.     lea.l    InputDevPort,a0
  1200.     move.l  d0,mp_SigTask(a0)
  1201.     move.l    a0,a1
  1202.     jsr    _LVOAddPort(a6)
  1203.  
  1204.     lea.l    InputRequestBlock,a0
  1205.     move.b    #NT_MESSAGE,io_Message+mn_Node+Ln_Type(a0)
  1206.     move.w    #$30,io_Message+mn_Length(a0)
  1207.     lea.l    InputDevPort,a1
  1208.     move.l    a1,io_Message+mn_ReplyPort(a0)
  1209.  
  1210.     lea.l    HandlerStuff,a1
  1211.     move.l    #myhandler,is_Code(a1)
  1212.     move.b    #127,is_Node+Ln_Pri(a1)
  1213.     move.l    #0,is_Data(a1)
  1214.     
  1215.     lea.l    InputRequestBlock,a1
  1216.     lea.l    InputDeviceName,a0
  1217.     clr.l    d0
  1218.     clr.l    d1
  1219.     jsr    _LVOOpenDevice(a6)
  1220.  
  1221.     lea.l    InputRequestBlock,a0
  1222.     move.w    #IND_ADDHANDLER,io_Command(a0)
  1223.     move.l    #HandlerStuff,io_Data(a0)
  1224.     move.l    a0,a1
  1225.     jsr    _LVODoIO(a6)        ; Install handler
  1226.  
  1227.     rts
  1228.     
  1229. ;====================================
  1230. ;=    Code for checking the Amiga   =
  1231. ;====================================
  1232.  
  1233.  
  1234. check    bsr    checkevents        ; Any messages ???
  1235.     bsr.s    chlus            ; Check routine
  1236.     move.l    DOSBase,a6
  1237.     moveq    #50,d1
  1238.     jsr    _LVODelay(a6)
  1239.     bra.s    check
  1240.  
  1241. chlus    move.l    $4,a0
  1242.     move.l    a0,a6
  1243.     clr.l    d2
  1244.     tst.l    42(a0)
  1245.     beq.s    1$
  1246.     ori.l    #1,d2
  1247. 1$    tst.l    46(a0)
  1248.     beq.s    2$
  1249.     ori.l    #1,d2
  1250. 2$    tst.l    546(a0)
  1251.     beq.s    3$
  1252.     ori.l    #2,d2
  1253. 3$    tst.l    550(a0)
  1254.     beq.s    4$
  1255.     ori.l    #2,d2
  1256. 4$    lea.l    350(a0),a0
  1257.     lea.l    devicename,a1
  1258.     move.l    $4,a6    
  1259.      jsr    _LVOFindName(a6)
  1260.     move.l    d0,a0
  1261.     move.l    -28(a0),d1
  1262.     cmp.l    #$fc0000,d1
  1263.     bhs.s    5$
  1264.     ori.l    #8,d2
  1265. 5$    move.l    $4,a0
  1266.     move.l    -454(a0),d1
  1267.     cmp.l    DoIOVector,d1
  1268.     beq.s    6$
  1269.     ori.l    #4,d2
  1270. 6$    lea.l    TaskName,a1
  1271.     jsr    _LVOFindTask(a6)
  1272.     tst.l    d0
  1273.     beq.s    7$
  1274.     ori.l    #16,d2
  1275. 7$    andi.l    #31,d2
  1276.     move.l    d2,memorymask
  1277.     moveq    #0,d0
  1278.     lea.l    expert,a0
  1279.     move.b    0(a0,d2),d0
  1280.     cmp.b    #0,d0
  1281.     beq.s    novirus
  1282.     cmp.b    #2,d0
  1283.     beq.s    novirus
  1284.     move.b    d0,signal
  1285. novirus
  1286.     rts
  1287.     
  1288.         
  1289. ;======================================================
  1290. ;= The Input Device Handler for checking the Help Key =
  1291. ;======================================================
  1292.  
  1293. myhandler            ; The input_handler
  1294.     cmp.b    #IECLASS_RAWKEY,4(a0)
  1295.     beq.s    akey
  1296. noop    move.l    a0,d0        ; Return head of list
  1297.     rts
  1298. akey    move.w    8(a0),d0
  1299.     and.w    #IEQUALIFIER_CONTROL,d0        ; Mask Control bit
  1300.     beq.s    noop                ; None of my keys
  1301.     cmp.w    #HELP_KEY,6(a0)
  1302.     bne.s    1$        ; Check next key
  1303.     move.w    #HELP_KEY,keyfound
  1304.     bra    needed
  1305. 1$    cmp.w    #FUNC_F1,6(a0)
  1306.     bne.s    2$
  1307.     move.w    #FUNC_F1,keyfound
  1308.     bra    needed
  1309. 2$    cmp.w    #FUNC_F2,6(a0)
  1310.     bne.s    3$
  1311.     move.w    #FUNC_F2,keyfound
  1312.     bra    needed
  1313. 3$    cmp.w    #FUNC_F3,6(a0)
  1314.     bne.s    4$
  1315.     move.w    #FUNC_F3,keyfound
  1316.     bra    needed
  1317. 4$    cmp.w    #FUNC_F4,6(a0)
  1318.     bne.s    5$
  1319.     move.w    #FUNC_F4,keyfound
  1320.     bra    needed
  1321. 5$    cmp.w    #FUNC_F5,6(a0)
  1322.     bne.s    6$
  1323.     move.w    #FUNC_F5,keyfound
  1324.     bra    needed
  1325. 6$    cmp.w    #FUNC_F6,6(a0)
  1326.     bne.s    7$
  1327.     move.w    #FUNC_F6,keyfound
  1328.     bra    needed
  1329. 7$    cmp.w    #FUNC_F7,6(a0)
  1330.     bne.s    8$
  1331.     move.w    #FUNC_F7,keyfound
  1332.     bra    needed
  1333. 8$    cmp.w    #FUNC_F8,6(a0)
  1334.     bne.s    9$
  1335.     move.w    #FUNC_F8,keyfound
  1336.     bra    needed
  1337. 9$    cmp.w    #FUNC_F9,6(a0)
  1338.     bne.s    10$
  1339.     move.w    #FUNC_F9,keyfound
  1340.     bra    needed
  1341. 10$    cmp.w    #FUNC_F10,6(a0)
  1342.     bne    noop
  1343.     move.w    #FUNC_F10,keyfound
  1344. needed    move.b    #1,Flag        ; Big Brother Control Window is needed !
  1345.     move.l    (a0),a0
  1346.     cmp.l    #0,a0
  1347.     beq.s    out
  1348.     bra    myhandler    ; Process more events !
  1349. out    clr.l    d0        ; End of chain
  1350.     rts
  1351.  
  1352. ;=====================================================
  1353. ;= Checks if an event has occured and responds to it =
  1354. ;=====================================================
  1355.     
  1356. checkevents
  1357.     clr.l    d0
  1358.     move.b    signal,d0
  1359.     beq.s    no_virus_signal
  1360.     cmp.b    #2,d0
  1361.     beq.s    no_virus_signal
  1362.     bra.s    activate    ; Open window etc., a virus !!!
  1363. no_virus_signal:
  1364.     move.b    Flag,d0
  1365.     beq.s    1$        ; No keys has been pressed
  1366.     move.w    keyfound,d0
  1367.     cmp.w    #FUNC_F1,d0
  1368.     beq    newcli        ; Spawn a cli
  1369.     cmp.w    #HELP_KEY,d0
  1370.     beq.s    activate
  1371.     bra    do_function_keys
  1372. 1$    rts
  1373.  
  1374. ;=========================================================
  1375. ;= Routine for the window processing in case of an event =
  1376. ;=========================================================
  1377.  
  1378. activate
  1379.     move.l    IntuitionBase,a6
  1380.     jsr    _LVOWBenchToFront(a6)
  1381.     move.l    #NewWindowStructure1,a0
  1382.     jsr    _LVOOpenWindow(a6)
  1383.     move.l    d0,window
  1384.     move.l    d0,a0
  1385.     move.l    wd_RPort(a0),rp
  1386.     move.l    rp,a0
  1387.     move.l    #Border2,a1
  1388.     moveq    #0,d0
  1389.     moveq    #0,d1
  1390.     jsr    _LVODrawBorder(a6)    
  1391.     bsr    printstatus
  1392. waitloop:
  1393.     move.l    window,a0
  1394.     move.l    wd_UserPort(a0),a0
  1395.     move.l    a0,userport
  1396.     moveq    #0,d1
  1397.     move.b    mp_SigBit(a0),d1
  1398.     moveq    #1,d0
  1399.     asl.l    d1,d0
  1400.     move.l    $4,a6
  1401.     jsr    _LVOWait(a6)    ; Wait for an event
  1402. look    move.l    $4,a6
  1403.     move.l    userport,a0    ; Get UserPort
  1404.     jsr    _LVOGetMsg(a6)    ; Get Message from IDCMP Port
  1405.     tst.l    d0
  1406.     beq    waitloop    ; No more messages left
  1407.     move.l    d0,a1
  1408.     move.l    im_Class(a1),d4
  1409.     move.l    im_Code(a1),d5
  1410.     move.l    im_Address(a1),a2
  1411.     jsr    _LVOReplyMsg(a6) ; Reply the message
  1412.  
  1413.     cmp.l    #CLOSEWINDOW,d4
  1414.     beq.s    watchmode
  1415.     cmp.l    #GADGETUP,d4
  1416.     bne.s    look
  1417.  
  1418.     bsr.s    process_gadgets    ; Someone has pressed a gadget
  1419.     cmp.w    #WATCH,d0
  1420.     bne.s    look
  1421.  
  1422. watchmode:
  1423.     move.l    IntuitionBase,a6
  1424.     move.l    window,a0
  1425.     jsr    _LVOCloseWindow(a6)
  1426.     move.b    #0,Flag
  1427.     move.b    #0,signal
  1428.     rts
  1429.  
  1430. ;==================================
  1431. ;= Routine for processing Gadgets =
  1432. ;==================================
  1433.  
  1434. process_gadgets:
  1435.     move.w    gg_GadgetID(a2),d0
  1436.     cmp.w    #WATCH,d0
  1437.     bne.s    1$
  1438.     rts
  1439. 1$    cmp.w    #DRIVE,d0
  1440.     beq.s    nextdrive
  1441.     cmp.w    #CLEAR,d0
  1442.     beq    clearmemory
  1443.     cmp.w    #VIEW,d0
  1444.     beq    viewbootblock
  1445.     cmp.w    #INSTALL,d0
  1446.     beq    installdisk
  1447.     cmp.w    #MEMORY,d0
  1448.     beq    viewmemory
  1449.     cmp.w    #NEWSHELL,d0
  1450.     beq    newcli
  1451.     cmp.w    #HELP,d0
  1452.     beq    showhelp
  1453.     cmp.w    #REBOOT,d0
  1454.     beq    reboot
  1455.     clr.l    d0        ; Clear d0 if GadgetID <> WATCH
  1456.     rts
  1457.  
  1458. ;==============================
  1459. ;= Finds next available drive =
  1460. ;==============================
  1461.  
  1462. nextdrive:
  1463.     move.b    drive,d0
  1464.     addq    #1,d0
  1465.     cmp.b    #4,d0        ; drive number too high ???
  1466.     bne.s    1$
  1467.     moveq    #0,d0        ; just select df0:
  1468. 1$    cmp.b    #0,d0
  1469.     bne.s    2$
  1470.     move.l    df0,ITextText1
  1471. 2$    cmp.b    #1,d0
  1472.     bne.s    3$
  1473.     move.l    df1,ITextText1
  1474. 3$    cmp.b    #2,d0
  1475.     bne.s    4$
  1476.     move.l    df2,ITextText1
  1477. 4$    cmp.b    #3,d0
  1478.     bne.s    5$
  1479.     move.l    df3,ITextText1
  1480. 5$    move.b    d0,drive
  1481.     move.l    #ITextText1,d1
  1482.     move.l    DOSBase,a6
  1483.     jsr    _LVODeviceProc(a6)    ; Does drive exists ?
  1484.     tst.l    d0
  1485.     bne.s    6$        ; Yeah
  1486.     bra.s    nextdrive    ; Try next drive
  1487. 6$    move.l    #Gadget1,a0
  1488.     move.l    window,a1
  1489.     move.l    #0,a2
  1490.     move.l    IntuitionBase,a6
  1491.     jsr    _LVORefreshGadgets(a6)
  1492.     clr.l    d0
  1493.     rts
  1494.  
  1495. ;================================
  1496. ;= Clears memory area from viri =
  1497. ;================================
  1498.  
  1499. clearmemory:
  1500.     bsr    yesno            ; Are you sure????
  1501.     tst.l    d0
  1502.     beq    clearexit        ; Noop
  1503.     move.l    $4,a6
  1504.     jsr    _LVODisable(a6)
  1505.     lea.l    TaskName,a1
  1506.     jsr    _LVOFindTask(a6)
  1507.     tst.l    d0
  1508.     beq.s    1$            ; No rad
  1509.     move.l    d0,a1
  1510.     jsr    _LVORemTask(a6)        ; Kill it!!!
  1511. 1$    move.l    $4,a6
  1512.     clr.l    42(a6)
  1513.     clr.l    46(a6)
  1514.     clr.l    546(a6)
  1515.     clr.l    550(a6)
  1516.     clr.l    554(a6)
  1517.     move.l    DoIOVector,-454(a6)
  1518.     clr.l    d1
  1519.     lea.l    34(a6),a0
  1520.     move.w    #$16,d0
  1521. loop    add.w    (a0)+,d1
  1522.     dbf    d0,loop
  1523.     not.w    d1
  1524.     move.w    d1,82(a6)
  1525.     jsr    _LVOEnable(a6)
  1526.     move.l    IntuitionBase,a6
  1527.     move.l    #0,a0
  1528.     jsr    _LVODisplayBeep(a6)
  1529.     move.l    $4,a6
  1530.     move.b    #0,signal
  1531.     bsr    chlus            ; Check memory
  1532.     bsr    printstatus        ; Show current memory status
  1533. clearexit:
  1534.     clr.l     d0            ; No WATCH Gadget
  1535.     rts
  1536.  
  1537. ;====================================
  1538. ;= Are you sure to clear memory???? =
  1539. ;====================================
  1540.  
  1541. yesno:
  1542.     move.l    IntuitionBase,a6
  1543.     move.l    #0,d0
  1544.     move.l    #Alertstring,a0
  1545.     move.l    #50,d1
  1546.     jsr    _LVODisplayAlert(a6)
  1547.     rts
  1548.  
  1549. ;====================================
  1550. ;= Are you sure to reboot????       =
  1551. ;====================================
  1552.  
  1553. yesno2:
  1554.     move.l    IntuitionBase,a6
  1555.     move.l    #0,d0
  1556.     move.l    #Alertstring2,a0
  1557.     move.l    #50,d1
  1558.     jsr    _LVODisplayAlert(a6)
  1559.     rts
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565. ;==================================================
  1566. ;= Routine shows a bootblock in ascii in a window =
  1567. ;==================================================
  1568.  
  1569. viewbootblock:
  1570.     move.w    #534,hsize        ; Adjust windowwidth
  1571.     move.w    #150,hsize+2        ; Adjust height
  1572.     lea.l    InitTitle,a0
  1573.     move.l    a0,title2
  1574.     move.l    IntuitionBase,a6
  1575.     move.l    #NewWindowStructure2,a0
  1576.     jsr    _LVOOpenWindow(a6)
  1577.     move.l    d0,window2
  1578.     move.l    d0,a0
  1579.     move.l    wd_RPort(a0),rp2
  1580.  
  1581.     move.l    $4,a6
  1582.     move.l    #1024,d0
  1583.     moveq    #2,d1            ; Chip memory needed
  1584.     jsr    _LVOAllocMem(a6)    ; Allocate buffer for bootblock
  1585.     move.l    d0,buffer
  1586.     
  1587.     bsr    readbootblock
  1588.     move.b    io_error,d0
  1589.     cmp.b    #29,d0
  1590.     bne    1$            ; Disk is available
  1591.  
  1592.     move.l    window2,a0
  1593.     move.l    #-234,d0
  1594.     move.l    #-100,d1
  1595.     move.l    IntuitionBase,a6
  1596.     jsr    _LVOSizeWindow(a6)    ; Make window smaller
  1597.     move.l    #disk_changed,Mt5
  1598.     move.l    #disk_changed,Mt6
  1599.     move.l    rp2,a0
  1600.     clr.l    d0
  1601.     clr.l    d1
  1602.     move.l    #MyTekst5,a1
  1603.     jsr    _LVOPrintIText(a6)    ; No disk !
  1604.     bra    2$            ; skip printbuffer
  1605.  
  1606.  
  1607. 1$    bsr    printbuffer
  1608.  
  1609. 2$    move.l    buffer,a1
  1610.     move.l    #1024,d0
  1611.     move.l    $4,a6
  1612.     jsr    _LVOFreeMem(a6)        ; Free buffer for bootblock
  1613.  
  1614.     move.l    window2,a0
  1615.     bsr    waitforclose        ; Wait for closegadget
  1616.  
  1617.     move.l    IntuitionBase,a6
  1618.     move.l    window2,a0
  1619.     jsr    _LVOCloseWindow(a6)
  1620.     clr.l    d0            ; No WATCH Gadget
  1621.     rts
  1622.  
  1623. ;====================================
  1624. ;= Routine for installing your disk =
  1625. ;====================================
  1626.  
  1627. installdisk:
  1628.     move.w    #300,hsize
  1629.     move.w    #50,hsize+2        ; Adjust height
  1630.     lea.l    InstallTitle,a0
  1631.     move.l    a0,title2
  1632.     move.l    IntuitionBase,a6
  1633.     move.l    #NewWindowStructure2,a0
  1634.     jsr    _LVOOpenWindow(a6)
  1635.     move.l    d0,window2
  1636.     move.l    d0,a0
  1637.     move.l    wd_RPort(a0),rp2
  1638.  
  1639.     move.l    $4,a6
  1640.     move.l    #1024,d0
  1641.     move.l    #2+1<<16,d1        ; Cleared Chip memory needed
  1642.     jsr    _LVOAllocMem(a6)    ; Allocate buffer for bootblock
  1643.     move.l    d0,buffer
  1644.     beq    skip_install        ; Prevent a guru
  1645.     
  1646.     lea.l    bootcode,a0
  1647.     move.l    d0,a1
  1648.     move.l    #bootendcode-bootcode-1,d1
  1649. 1$    move.b    (a0)+,(a1)+        ; Copy bootblock into buffer
  1650.     dbra    d1,1$            
  1651.     move.l    #StandardBootBlock,a0
  1652.     move.l    #Standardend-StandardBootBlock-1,d1
  1653. 2$    move.b    (a0)+,(a1)+
  1654.     dbra    d1,2$
  1655.  
  1656.     bsr    sum
  1657.     bsr    writebuffer
  1658.  
  1659.     move.l    buffer,a1
  1660.     move.l    #1024,d0
  1661.     move.l    $4,a6
  1662.     jsr    _LVOFreeMem(a6)        ; Free buffer for bootblock
  1663.  
  1664.     tst.b    io_error
  1665.     bne.s    3$            ; An error has occured
  1666.     move.l    #install_message,Mt5
  1667.     move.l    #install_message,Mt6
  1668.     bra.s    install_m
  1669. 3$    move.b    io_error,d0
  1670.     cmp.b    #28,d0            ; disk protected???
  1671.     bne    4$
  1672.     move.l    #disk_protected,Mt5
  1673.     move.l    #disk_protected,Mt6
  1674.     bra    install_m
  1675. 4$    cmp.b    #29,d0            ; disk changed ????
  1676.     bne    5$
  1677.     move.l    #disk_changed,Mt5
  1678.     move.l    #disk_changed,Mt6
  1679.     bra    install_m
  1680. 5$    move.l    #install_fail,Mt5    ; Unknown failure
  1681.     move.l    #install_fail,Mt6
  1682. install_m
  1683.     move.l    rp2,a0
  1684.     clr.l    d0
  1685.     clr.l    d1
  1686.     move.l    #MyTekst5,a1
  1687.     move.l    IntuitionBase,a6
  1688.     jsr    _LVOPrintIText(a6)
  1689.     
  1690.  
  1691.     move.l    window2,a0
  1692.     bsr    waitforclose        ; Wait for closegadget
  1693.  
  1694. skip_install:
  1695.     move.l    IntuitionBase,a6
  1696.     move.l    window2,a0
  1697.     jsr    _LVOCloseWindow(a6)
  1698.     clr.l    d0            ; No WATCH Gadget
  1699.     rts
  1700.  
  1701. ;=============================================
  1702. ;= Routine for displaying a part of ExecBase =
  1703. ;=============================================
  1704.  
  1705.  
  1706. viewmemory:
  1707.     move.w    #318,hsize
  1708.     move.w    #100,hsize+2        ; Adjust height
  1709.     lea.l    ViewTitle,a0
  1710.     move.l    a0,title2
  1711.     move.l    IntuitionBase,a6
  1712.     move.l    #NewWindowStructure2,a0
  1713.     jsr    _LVOOpenWindow(a6)
  1714.     move.l    d0,window2
  1715.     move.l    d0,a0
  1716.     move.l    wd_RPort(a0),rp2
  1717.  
  1718.     move.l    $4,a6
  1719.     move.l    #5*80,d0
  1720.     move.l    #1<<16,d1            
  1721.     jsr    _LVOAllocMem(a6)    ; Allocate buffer
  1722.     move.l    d0,buffer
  1723.     move.l    d0,-(a7)
  1724.  
  1725.     move.l    d0,MTE8
  1726.     move.l    d0,MTE8b
  1727.     add.l    #80,d0
  1728.     move.l    d0,MTE9
  1729.     move.l    d0,MTE9b
  1730.     add.l    #80,d0
  1731.     move.l    d0,MTE10
  1732.     move.l    d0,MTE10b
  1733.     add.l    #80,d0
  1734.     move.l    d0,MTE11
  1735.     move.l    d0,MTE11b
  1736.     add.l    #80,d0
  1737.     move.l    d0,MTE12
  1738.     move.l    d0,MTE12b
  1739.  
  1740.  
  1741.  
  1742. ;======== ColdCapture ==============
  1743.  
  1744.     lea.l    coldcapture,a0
  1745.     move.l    buffer,a1
  1746.     bsr    stringcopy
  1747.     
  1748.     move.l    $4,a6
  1749.     move.l    42(a6),a0
  1750.     bsr    makestring
  1751.  
  1752.  
  1753. ;======= CoolCapture =============
  1754.  
  1755.     add.l    #80,buffer    
  1756.     lea.l    coolcapture,a0
  1757.     move.l    buffer,a1
  1758.     bsr    stringcopy
  1759.     
  1760.     move.l    $4,a6
  1761.     move.l    46(a6),a0
  1762.     bsr    makestring
  1763.  
  1764.  
  1765. ;======== KickMemPtr ===============
  1766.  
  1767.     add.l    #80,buffer
  1768.     lea.l    kickmemptr,a0
  1769.     move.l    buffer,a1
  1770.     bsr    stringcopy
  1771.     
  1772.     move.l    $4,a6
  1773.     move.l    546(a6),a0
  1774.     bsr    makestring
  1775.  
  1776.  
  1777. ;========== KickTagPtr ================
  1778.  
  1779.     add.l    #80,buffer
  1780.     lea.l    kicktagptr,a0
  1781.     move.l    buffer,a1
  1782.     bsr    stringcopy
  1783.     
  1784.     move.l    $4,a6
  1785.     move.l    550(a6),a0
  1786.     bsr    makestring
  1787.  
  1788. ;==== DoIO =========================
  1789.  
  1790.     add.l    #80,buffer
  1791.     lea.l    doio_vector,a0
  1792.     move.l    buffer,a1
  1793.     bsr    stringcopy
  1794.     
  1795.     move.l    $4,a6
  1796.     move.l    -454(a6),a0
  1797.     bsr    makestring
  1798.  
  1799. ;===== Rad ============================
  1800.  
  1801.     move.l    $4,a6
  1802.     lea.l    TaskName,a1
  1803.     jsr    _LVOFindTask(a6)
  1804.     tst.l    d0
  1805.     beq.s    no_rad            ; No rad
  1806.     move.l    #found_rad,MTE13
  1807.     move.l    #found_rad,MTE13b
  1808.     bra.s    rad_cont
  1809. no_rad    move.l    #no_found_rad,MTE13
  1810.     move.l    #no_found_rad,MTE13b
  1811. rad_cont:
  1812.  
  1813.     move.l    rp2,a0
  1814.     clr.l    d0
  1815.     clr.l    d1
  1816.     move.l    #IText8,a1
  1817.     move.l    IntuitionBase,a6
  1818.     jsr    _LVOPrintIText(a6)
  1819.     
  1820.     move.l    $4,a6
  1821.     move.l    #5*80,d0
  1822.     move.l    (a7)+,a1            
  1823.     jsr    _LVOFreeMem(a6)        ; Free  buffer
  1824.     
  1825.     move.l    window2,a0
  1826.     bsr    waitforclose
  1827.  
  1828.     move.l    IntuitionBase,a6
  1829.     move.l    window2,a0
  1830.     jsr    _LVOCloseWindow(a6)
  1831.  
  1832.     clr.l    d0            ; No WATCH Gadget
  1833.     rts
  1834.  
  1835. ;==============
  1836. ;= Makestring =
  1837. ;==============
  1838.  
  1839. makestring:
  1840.     move.l    $4,a6
  1841.     lea.l    number,a1
  1842.     bsr.s    convert
  1843.  
  1844.     lea.l    number,a1
  1845.     move.l    buffer,a0
  1846.     bsr.s    stringadd
  1847.     rts
  1848.  
  1849. ;========================
  1850. ;= Copy string a0 -> a1 =
  1851. ;========================
  1852.  
  1853. stringcopy:
  1854. 1$    move.b    (a0)+,d0
  1855.     move.b    d0,(a1)+
  1856.     bne.s     1$
  1857.     rts
  1858.  
  1859. ;==============================
  1860. ;= Add string a1 to string a0 =
  1861. ;==============================
  1862.  
  1863. stringadd:
  1864.     move.l    a2,-(a7)
  1865. 1$    cmp.b    #0,(a0)+        ; Find end of string a0
  1866.     bne.s    1$
  1867.     subq    #1,a0
  1868.     move.l    a0,a2
  1869.     move.l    a1,a0
  1870.     move.l    a2,a1
  1871.     bsr.s    stringcopy        ; Paste a1 to a0
  1872.     move.l    (a7)+,a2
  1873.     rts
  1874.  
  1875. ;==========================================
  1876. ;= Convert value in a0 to buffer a1 (Hex) =
  1877. ;==========================================
  1878.  
  1879. convert:
  1880.     movem.l    d2-d3/a2,-(a7)
  1881.     lea.l    convtable,a2
  1882.     move.l    a0,d1
  1883.     moveq    #7,d3
  1884. 1$    move.l    d1,d2
  1885.     and.l    #$f,d2
  1886.     move.l    d2,d0
  1887.     move.b    0(a2,d0),-(a7)
  1888.     lsr.l    #4,d1
  1889.     dbra    d3,1$
  1890.     moveq    #7,d3
  1891. 2$    move.b    (a7)+,(a1)+
  1892.     dbra    d3,2$
  1893.     movem.l    (a7)+,d2-d3/a2
  1894.     rts
  1895.  
  1896.  
  1897.  
  1898.  
  1899. ;=========================================
  1900. ;= Calculates lenght of string in buffer =
  1901. ;= Returns lenght in d0                  =
  1902. ;=========================================
  1903.  
  1904. length:
  1905.     clr.l    d0
  1906.     move.l    a5,-(a7)
  1907.     move.l    buffer,a5
  1908. 1$    addq    #1,d0
  1909.     cmp.b    #0,(a5)+
  1910.     bne.s    1$
  1911.     subq    #1,d0
  1912.     move.l    (a7)+,a5
  1913.     rts
  1914. ;=======================================
  1915. ;= Waits for closegadget to be pressed =
  1916. ;=======================================
  1917.  
  1918. waitforclose:
  1919.     move.l    $4,a6
  1920.     move.l    a5,-(a7)
  1921.     move.l  a0,a5
  1922. 1$    move.l    a5,a0
  1923.     move.l    wd_UserPort(a0),a0
  1924.     move.l    a0,-(a7)
  1925.     moveq    #0,d1
  1926.     move.b    mp_SigBit(a0),d1
  1927.     moveq    #1,d0
  1928.     asl.l    d1,d0
  1929.     jsr    _LVOWait(a6)    ; Wait for an event
  1930.     move.l    (a7)+,a0    ; Get UserPort
  1931.     jsr    _LVOGetMsg(a6)    ; Get Message from IDCMP Port
  1932.     move.l    d0,a1
  1933.     move.l    im_Class(a1),d4
  1934.     jsr    _LVOReplyMsg(a6) ; Reply the message
  1935.  
  1936.     cmp.l    #CLOSEWINDOW,d4
  1937.     bne.s    1$
  1938.     move.l    (a7)+,a5
  1939.     rts
  1940.  
  1941.  
  1942. ;========================================
  1943. ;= Prints current virusstatus in window =
  1944. ;========================================
  1945.  
  1946. printstatus:
  1947.     move.l    window,a0
  1948.     move.l    wd_RPort(a0),a1
  1949.     move.l    a1,rp        ; Store RastPort
  1950.  
  1951.     moveq    #0,d1
  1952.     move.b    signal,d1
  1953.     beq.s    1$        ; No extra message needed (=Clean)
  1954.     cmp.b    #2,d1
  1955.     beq.s    1$        ; The same...
  1956.     move.l    #message,Mt3    ; System has been modified!
  1957.     move.l    #message,Mt4
  1958.     bra    12$
  1959.  
  1960. 1$    move.l    rp,a0        ; Clear message box
  1961.     clr.    d0
  1962.     clr.l    d1
  1963.     move.l    #MyTekst3a,a1
  1964.     move.l    IntuitionBase,a6
  1965.     jsr    _LVOPrintIText(a6)
  1966.     
  1967.     move.l    #L9,Mt3        ; Clear previous(?) message!
  1968.     move.l    #L9,Mt4
  1969.     
  1970.  
  1971. 12$    move.l    rp,a0
  1972.     clr.    d0
  1973.     clr.l    d1
  1974.     move.l    #MyTekst3,a1
  1975.     move.l    IntuitionBase,a6
  1976.     jsr    _LVOPrintIText(a6)
  1977.     
  1978.     move.b    signal,d1
  1979.     cmp.b    #0,d1
  1980.     bne.s    2$
  1981.     lea.l    L0,a0
  1982.     bra.s    10$
  1983. 2$    cmp.b    #1,d1
  1984.     bne.s    3$
  1985.     lea.l    L1,a0
  1986.     bra.s    10$
  1987. 3$    cmp.b    #2,d1
  1988.     bne.s    4$
  1989.     lea.l    L2,a0
  1990.     bra.s    10$
  1991. 4$    cmp.b    #3,d1
  1992.     bne.s    5$
  1993.     lea.l    L3,a0
  1994.     bra.s    10$
  1995. 5$    cmp.b    #4,d1
  1996.     bne.s    6$
  1997.     lea.l    L4,a0
  1998.     bra.s    10$
  1999. 6$    cmp.b    #5,d1
  2000.     bne.s    7$
  2001.     lea.l    L5,a0
  2002.     bra.s    10$
  2003. 7$    cmp.b    #6,d1
  2004.     bne.s    8$
  2005.     lea.l    L6,a0
  2006.     bra.s    10$
  2007. 8$    cmp.b    #7,d1
  2008.     bne.s    9$
  2009.     lea.l    L7,a0
  2010.     bra.s    10$
  2011. 9$    cmp.b    #8,d1
  2012.     bne.s    11$
  2013.     lea.l    L8,a0
  2014. 10$    move.l    a0,Mt1
  2015.     move.l    a0,Mt2
  2016.     move.l    rp,a0
  2017.     move.l    #MyTekst,a1
  2018.     clr.l    d0
  2019.     clr.l    d1
  2020.     move.l    IntuitionBase,a6
  2021.     jsr    _LVOPrintIText(a6)
  2022. 11$    rts
  2023.  
  2024.  
  2025. ;======================================
  2026. ;= Prints buffer in ascii on a window =
  2027. ;======================================
  2028.  
  2029. printbuffer:
  2030.     move.l    buffer,a3
  2031.     move.l    a3,a4
  2032.     move.l    #1023,d1
  2033.     clr.l    d0
  2034. cloop    move.b    (a3)+,d0
  2035.     cmp.b    #31,d0
  2036.     bls.s    outrange
  2037.     cmp.b    #127,d0
  2038.     bhs.s    outrange
  2039.     move.b    d0,(a4)+
  2040.     dbra    d1,cloop
  2041.     bra.s    printit
  2042. outrange:
  2043.     move.b    #'.',(a4)+
  2044.     dbra    d1,cloop
  2045. printit:
  2046.     move.l    window2,a0
  2047.     move.l    wd_RPort(a0),rp2
  2048.     moveq    #0,d3
  2049.     move.l    buffer,a3
  2050. ploop    move.l    d3,d1
  2051.     mulu    #8,d1
  2052.     add.l    #20,d1
  2053.     move.w    d1,y1
  2054.     subq    #1,d1
  2055.     move.w    d1,y2
  2056.  
  2057.     
  2058.     move.l    #dummy,a2
  2059.     move.l    d3,d1
  2060.     mulu    #64,d1
  2061.     move.l    a3,a0
  2062.     add.l    d1,a0
  2063.     moveq    #63,d0
  2064. 1$    move.b    (a0)+,(a2)+        ; copy string to dummy
  2065.     dbra    d0,1$
  2066.     move.b    #0,(a2)            ; end string with 0
  2067.  
  2068.     clr.l    d0
  2069.     clr.l    d1
  2070.     move.l    rp2,a0
  2071.     lea.l    IText14,a1
  2072.     move.l    IntuitionBase,a6
  2073.     jsr    _LVOPrintIText(a6)
  2074.  
  2075.     addq    #1,d3
  2076.     cmp.l    #15,d3
  2077.     bls.s    ploop
  2078.     rts
  2079.  
  2080. ;============================
  2081. ;= Read bootblock in buffer =
  2082. ;============================
  2083.  
  2084. readbootblock:
  2085.     move.w    #READ,commando
  2086.     bsr.s    bootio
  2087.     rts
  2088.  
  2089. ;=============================
  2090. ;= Write buffer to bootblock =
  2091. ;=============================
  2092.  
  2093. writebuffer:
  2094.     move.w    #WRITE,commando
  2095.     bsr.s    bootio
  2096.     rts
  2097.  
  2098.  
  2099. ;==========================================
  2100. ;= Multi function boot read/write routine =
  2101. ;=                      =
  2102. ;= io_error contains error on exit          =
  2103. ;=                      =
  2104. ;==========================================
  2105.  
  2106. bootio:
  2107.     move.l    $4,a6
  2108.     
  2109.     sub.l    a1,a1
  2110.     jsr    _LVOFindTask(a6)
  2111.     move.l    d0,readreply+$10
  2112.     lea.l    readreply,a1
  2113.     jsr    _LVOAddPort(a6)
  2114.     lea.l    diskio,a1
  2115.     moveq    #0,d0
  2116.     move.b    drive,d0
  2117.     clr.l    d1
  2118.     lea.l    devicename,a0
  2119.     jsr    _LVOOpenDevice(a6)
  2120.     tst.l    d0
  2121.     beq.s    tskip
  2122.     lea.l    readreply,a1
  2123.     jsr    _LVORemPort(a6)
  2124.     bra    trackerror
  2125. tskip    lea.l    diskio,a1
  2126.     move.l    buffer,40(a1)
  2127.     move.l    #readreply,14(a1)
  2128.     move.w    #TD_CHANGESTATE,28(a1)
  2129.     jsr    _LVODoIO(a6)
  2130.     move.l    diskio+32,d6
  2131.     beq.s    tskip2
  2132.     move.b    #29,io_error
  2133.     bra    terror                ; No disk!
  2134.  
  2135. tskip2    move.w    commando,d5
  2136.     cmp.w    #READ,d5
  2137.     bne.s    1$                ; Don't CMD_CLEAR for a write
  2138.     lea.l    diskio,a1            ; We will read a bootblock
  2139.     move.l    buffer,40(a1)
  2140.     move.l    #readreply,14(a1)        ; so, force a reading
  2141.     move.w    #5,28(a1)
  2142.     jsr    _LVODoIO(a6)        ; CMD_Clear (Clear trackbuffer)
  2143.  
  2144. 1$    lea.l    diskio,a1
  2145.     move.l    #readreply,14(a1)
  2146.     move.w    commando,28(a1)
  2147.     move.l    buffer,40(a1)
  2148.     move.l    #1024,36(a1)
  2149.     move.l    #0,44(a1)
  2150.     move.l    $4,a6
  2151.     jsr    _LVODoIO(a6)
  2152.     move.b    diskio+31,io_error        ; Error number
  2153.  
  2154.     move.w    commando,d5
  2155.     cmp.w    #WRITE,d5
  2156.     bne.s    2$
  2157.  
  2158.     lea.l    diskio,a1
  2159.     move.l    buffer,40(a1)
  2160.     move.l    #readreply,14(a1)
  2161.     move.w    #4,28(a1)        ; CMD_UPDATE
  2162.     move.l    $4,a6
  2163.     jsr    _LVODoIO(a6)        ; Write all buffers out
  2164.     move.b    diskio+31,io_error    ; Get error number
  2165.  
  2166. 2$    tst.b    io_error
  2167.     beq.s    tgood
  2168. terror    lea.l    errormessage,a1
  2169.     move.l    window2,a0
  2170.     move.l    #0,a2
  2171.     move.l    IntuitionBase,a6
  2172.     jsr    _LVOSetWindowTitles(a6)
  2173.     move.l    $4,a6
  2174.     
  2175. tgood    lea.l    diskio,a1
  2176.     move.w    #9,28(a1)        ; TD_MOTOR
  2177.     move.l    #0,36(a1)
  2178.     jsr    _LVODoIO(a6)
  2179.  
  2180.     lea.l    readreply,a1
  2181.     jsr    _LVORemPort(a6)
  2182.     lea.l    diskio,a1
  2183.     jsr    _LVOCloseDevice(a6)
  2184.  
  2185. trackerror:
  2186.     rts
  2187.  
  2188. ;================================
  2189. ;= The maincode of my Bootblock =
  2190. ;================================
  2191.  
  2192. bootcode:
  2193.     dc.b    'DOS',0
  2194.     dc.l    0
  2195. root    dc.l    880
  2196. main    move.l    $4,a6
  2197.     lea.l    Dosname(pc),a1
  2198.     jsr    _LVOFindResident(a6)
  2199.     move.l    d0,a0
  2200.     move.l    22(a0),a0
  2201.     clr.l    d0
  2202.     rts
  2203. Dosname    dc.b    'dos.library',0
  2204. bootendcode:
  2205.  
  2206. ;=========================================================
  2207. ;= Routine which calculates the checksum of my bootblock =
  2208. ;=========================================================
  2209.     even
  2210.  
  2211. sum    clr.l    d0
  2212.     move.l    buffer,a0
  2213.     move.l    #255,d1
  2214. sumloop    add.l    (a0)+,d0
  2215.     bcc.s    sumcont
  2216.     addq    #1,d0
  2217. sumcont    dbra    d1,sumloop
  2218.     moveq    #-1,d1
  2219.     sub.l    d0,d1
  2220.     move.l    buffer,a2
  2221.     move.l    d1,4(a2)
  2222.     rts
  2223.  
  2224. ;===============================================
  2225. ;= This routine will spawn a new cli using arp =
  2226. ;===============================================
  2227.  
  2228. newcli:
  2229.     move.l    $4,a6
  2230.     lea.l    ArpName,a1
  2231.     clr.l    d0
  2232.     jsr    _LVOOpenLibrary(a6)
  2233.     move.l    d0,ArpBase
  2234.     bne    1$
  2235.     move.l    IntuitionBase,a6    ; Arp is not available
  2236.     move.l    #0,a0
  2237.     jsr    _LVODisplayBeep(a6)
  2238.     bra    2$
  2239. 1$    move.l    ArpBase,a6
  2240.     lea.l    CONNAME,a0
  2241.     move.l    #0,a1
  2242.     lea.l    newshell,a2
  2243.     jsr    _ASyncRun(a6)
  2244.     move.l    $4,a6
  2245.     move.l    ArpBase,a1
  2246.     jsr    _LVOCloseLibrary(a6)    ; Close Arp
  2247. 2$    move.b    #0,Flag            ; Clear key signal
  2248.     move.b    #0,keyfound
  2249.     clr.l    d0
  2250.     rts    
  2251.  
  2252.  
  2253. do_function_keys:
  2254.     cmp.w    #FUNC_F2,d0
  2255.     bne    1$
  2256.     lea.l    script2,a0
  2257.     bra    cont
  2258. 1$    cmp.w    #FUNC_F3,d0
  2259.     bne    2$
  2260.     lea.l    script3,a0
  2261.     bra    cont
  2262. 2$    cmp.w    #FUNC_F4,d0
  2263.     bne    3$
  2264.     lea.l    script4,a0
  2265.     bra    cont
  2266. 3$    cmp.w    #FUNC_F5,d0
  2267.     bne    4$
  2268.     lea.l    script5,a0
  2269.     bra    cont
  2270. 4$    cmp.w    #FUNC_F6,d0
  2271.     bne    5$
  2272.     lea.l    script6,a0
  2273.     bra    cont
  2274. 5$    cmp.w    #FUNC_F7,d0
  2275.     bne    6$
  2276.     lea.l    script7,a0
  2277.     bra    cont
  2278. 6$    cmp.w    #FUNC_F8,d0
  2279.     bne    7$
  2280.     lea.l    script8,a0
  2281.     bra    cont
  2282. 7$    cmp.w    #FUNC_F9,d0
  2283.     bne    8$
  2284.     lea.l    script9,a0
  2285.     bra    cont
  2286. 8$    cmp.w    #FUNC_F10,d0
  2287.     bne    ret
  2288.     lea.l    script10,a0
  2289. cont    move.l    a0,d1
  2290.     clr.l    d2
  2291.     clr.l    d3
  2292.     move.l    DOSBase,a6
  2293.     jsr    _LVOExecute(a6)
  2294.  
  2295. ret    move.b    #0,Flag            ; Clear key signal
  2296.     move.b    #0,keyfound
  2297.     clr.l    d0
  2298.     rts    
  2299.  
  2300.  
  2301.  
  2302. ;====================================
  2303. ;= Help routine: shows credits+help =
  2304. ;====================================
  2305.  
  2306. showhelp:
  2307.     move.w    #418,hsize
  2308.     move.w    #130,hsize+2        ; Adjust height
  2309.     move.l    #HelpTitle,title2
  2310.     move.l    IntuitionBase,a6
  2311.     move.l    #NewWindowStructure2,a0
  2312.     jsr    _LVOOpenWindow(a6)
  2313.     move.l    d0,window2
  2314.     move.l    d0,a0
  2315.     move.l    wd_RPort(a0),a0
  2316.     move.l    #Text15,a1
  2317.     clr.l    d0
  2318.     clr.l    d1
  2319.     jsr    _LVOPrintIText(a6)
  2320.  
  2321.     move.l    window2,a0
  2322.     bsr    waitforclose
  2323.  
  2324.     move.l    IntuitionBase,a6
  2325.     move.l    window2,a0
  2326.     jsr    _LVOCloseWindow(a6)
  2327.  
  2328.     clr.l    d0
  2329.     rts
  2330.  
  2331. ;======================
  2332. ;= The reboot routine =
  2333. ;======================
  2334.  
  2335. reboot    bsr    yesno2                ; Want to reboot???
  2336.     tst.l    d0
  2337.     bne.s    1$                ; noop
  2338.     rts
  2339. 1$    move.l    $4,a6
  2340.     move.l    #-1,$4
  2341.     cmp.w    #V36_EXEC,LIB_VERSION(a6)
  2342.     blt.s    old_exec
  2343.     jmp    TEMP_ColdReboot(a6)     ;Let Exec do it...
  2344.     ;NOTE: Control flow never returns to here
  2345.  
  2346.  
  2347. old_exec:    
  2348.     lea.l    GoAway(pc),a5           ;address of code to execute
  2349.     jsr    _LVOSupervisor(a6)      ;trap to code at (a5)...
  2350.     ;NOTE: Control flow never returns to here
  2351.  
  2352.  
  2353. ;-------------- MagicResetCode ---------DO NOT CHANGE-----------------------
  2354.  
  2355.         CNOP    0,4            ;IMPORTANT! Longword align!
  2356. GoAway:     lea.l    MAGIC_ROMEND,a0     ;(end of ROM)
  2357.         sub.l    MAGIC_SIZEOFFSET(a0),a0 ;(end of ROM)-(ROM size)=PC
  2358.         move.l    4(a0),a0                ;Get Initial Program Counter
  2359.         subq.l    #2,a0            ;now points to second RESET
  2360.         reset                ;first RESET instruction
  2361.         jmp    (a0)                    ;CPU Prefetch executes this
  2362.         ;NOTE: the RESET and JMP instructions must share a longword!
  2363.  
  2364. ;---------------------------------------DO NOT CHANGE-----------------------
  2365.  
  2366.  
  2367.  
  2368. ;=======================
  2369. ;= The Cleanup Routine =
  2370. ;=======================
  2371.  
  2372. exit    move.l    $4,a6
  2373.     move.l    GfxBase,a1
  2374.     jsr    _LVOCloseLibrary(a6)
  2375. nographics:
  2376.     move.l    IntuitionBase,a1
  2377.     jsr    _LVOCloseLibrary(a6)
  2378. nointuition:
  2379.     move.l    DOSBase,a1
  2380.     jsr    _LVOCloseLibrary(a6)
  2381. nodos    rts
  2382.  
  2383. ;=========================
  2384. ;= The end of the source =
  2385. ;=========================    
  2386.  
  2387.     end
  2388.  
  2389.  
  2390.  
  2391.  
  2392.